import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPool {

    public static void main(String[] args) {
        //创建线程池
        ExecutorService pool = Executors.newFixedThreadPool(10);
        //执行
        pool.execute(new MyThread1());
        pool.execute(new MyThread1());
        pool.execute(new MyThread1());
        pool.execute(new MyThread1());
        //关闭池子
        pool.shutdown();
    }
}

class MyThread1 implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
